<template>
  <div :style="style">
    <img :src="imgSrc" style="max-height: 100%;max-width: 100%;"/>
  </div>
</template>
<script>
export default {
  data() {
    return {
      imgSrc: 'https://249903.m.ecbao.cn/assets/store/img/diy/banner/01.png',
      style: ''
    }
  },

  methods: {

    setStyle(data) {
      if (data.src) this.imgSrc = data.src
      let style = []
      style.push('height:' + data['height'] + 'px')
      style.push('padding-top:' + data['top-margin'] + 'px')
      style.push('padding-top:' + data['top-margin'] + 'px')
      style.push('padding-bottom:' + data['bottom-margin'] + 'px')
      style.push('padding-left:' + data['left-margin'] + 'px')
      style.push('padding-right:' + data['right-margin'] + 'px')
      style.push('background:' + data['background'])
      this.style = style.join(';')
    }
  }
}
</script>